package com.huawei.hwclouds.lubanops.demo.product.biz.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huawei.hwclouds.lubanops.demo.common.biz.Mapper;
import com.huawei.hwclouds.lubanops.demo.common.biz.PageList;
import com.huawei.hwclouds.lubanops.demo.product.biz.mapper.MerchandiseMapper;
import com.huawei.hwclouds.lubanops.demo.product.biz.mapper.MerchandiseStockMapper;
import com.huawei.hwclouds.lubanops.demo.product.biz.model.MerchandiseModel;
import com.huawei.hwclouds.lubanops.demo.product.biz.model.MerchandiseStockModel;
import com.huawei.hwclouds.lubanops.demo.product.biz.param.MerchandiseParam;

/**
 * @author y00438022
 * @since 2020/8/17
 **/
@Service
public class MerchandiseService extends ConfigBizServiceBase<MerchandiseModel, MerchandiseParam> {

    @Autowired
    private MerchandiseMapper mapper;

    @Autowired
    private MerchandiseStockMapper stockMapper;

    @Override
    public Mapper<MerchandiseModel, MerchandiseParam> getMapper() {
        return mapper;
    }

    @Override
    public void create(MerchandiseModel model) {
        super.create(model);
    }

    @Override
    public Integer update(MerchandiseModel model) {
        return super.update(model);
    }

    @Override
    public PageList<MerchandiseModel> pageQuery(MerchandiseParam param) {
        return super.pageQuery(param);
    }

    @Override
    public MerchandiseModel retrieveById(Long id) {
        return super.retrieveById(id);
    }

    @Override
    public List<MerchandiseModel> findAll() {
        return super.findAll();
    }

    public void reduceRepertory(MerchandiseStockModel param) {
        stockMapper.reduceByMerchandiseId(param);
    }

    public List<MerchandiseModel> query(int index, int size) {
        return mapper.query(index, size);
    }
}
